package com.unicom.room.service;

import java.util.Date;
import java.util.List;

import com.unicom.room.mapper.HistoryRecordsMapper;
import com.unicom.room.model.CheckInVo;
import com.unicom.room.model.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;


@Service
@Transactional
public class HistoryRecordService {

	@Autowired
	private HistoryRecordsMapper historyRecordsMapper;

	public Page<CheckInVo> listHistoryRecords(int currentPage, int pageSize, String name, Date startDate, String queryFormat) {
		Page<CheckInVo> checkIns = new Page<>();
		checkIns.setData(historyRecordsMapper.listHistoryRecords((currentPage - 1) * pageSize, pageSize, name, startDate, queryFormat));
		checkIns.setTotal(historyRecordsMapper.getTotal(name, startDate, queryFormat));
		return checkIns;
	}
	
}
